package com.config;

import com.condition.ProCondition;
import com.condition.TestCondition;
import com.pojo.DataBase;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;

//@Configuration
public class DataBaseConfig {

    @Bean
    @Conditional({TestCondition.class})
    public DataBase testDataBase(){
        return new DataBase("jdbc:mysql://localhost:3306/test","root","test");
    }

    @Bean
    @Conditional({ProCondition.class})
    public DataBase proDataBase(){
        return new DataBase("jdbc:mysql://localhost:3306/test2","root","product");
    }
}
